type Tuple = [1, 2, 3];
type Push<Arr extends unknown[], E> = [...Arr, E];
type Result24 = Push<[1, 2, 3], 4>;

type Unshift<Arr extends unknown[], E> = [E, ...Arr];

type Result25 = Unshift<[1, 2, 3], 4>;

type Tuple1 = [1, 2];
type Tuple2 = ['limit', 'limit'];

type ZipSingle<Lhs extends [unknown, unknown], Rhs extends [unknown, unknown]> = Lhs extends [
  infer LhsFst,
  infer LhsSnd,
]
  ? Rhs extends [infer RhsFst, infer RhsSnd]
    ? [[LhsFst, RhsFst], [LhsSnd, RhsSnd]]
    : []
  : [];
type Result26 = ZipSingle<Tuple1, Tuple2>;

type Zip<Lhs extends unknown[], Rhs extends unknown[]> = Lhs extends [
  infer LhsFst,
  ...infer LhsRest,
]
  ? Rhs extends [infer RhsFst, ...infer RhsRest]
    ? [[LhsFst, RhsFst], ...Zip<LhsRest, RhsRest>]
    : []
  : [];

type Result27 = Zip<Tuple1, Tuple2>;

type CapitalizeStr<Str extends string> = Str extends `${infer Fst}${infer Rest}`
  ? `${Uppercase<Fst>}${Rest}`
  : Str;

type Result28 = CapitalizeStr<'limit'>;

type CamelCase<Str extends string> = Str extends `${infer Left}_${infer Right}${infer Rest}`
  ? `${Left}${Uppercase<Right>}${CamelCase<Rest>}`
  : Str;

type Result29 = CamelCase<'limit_a_b'>;

type RemoveStr<
  Str extends string,
  Substr extends string,
> = Str extends `${infer Prefix}${Substr}${infer Suffix}`
  ? RemoveStr<`${Prefix}${Suffix}`, Substr>
  : Str;

type Result30 = RemoveStr<'limit', 'it'>;

type AppendArgument<Func, Arg> = Func extends (...args: infer Args) => infer ReturnType
  ? (...args: [...Args, Arg]) => ReturnType
  : never;

type Result31 = AppendArgument<typeof fn, boolean>;

type Obj = { readonly name: string; age: number; remember: boolean };

type UppercaseKey<O extends Record<string, unknown>> = {
  [K in keyof O as Uppercase<K & string>]: O[K];
};

const a = { a: '1', b: 2 };
type Result32 = UppercaseKey<typeof a>;
const aa: Result32 = { A: '1', B: 2 };

type ToReadonly<T> = {
  readonly [K in keyof T]: T[K];
};

type Result33 = ToReadonly<typeof aa>;

type ToPartial<T> = {
  [K in keyof T]?: T[K];
};

type Result34 = ToPartial<typeof aa>;

type ToMultable<T> = {
  -readonly [K in keyof T]: T[K];
};

type Result35 = ToMultable<Obj>;

type ToRequired<T> = {
  [K in keyof T]-?: T[K];
};

type Result36 = ToRequired<Result34>;

type FilterByValueType<T extends Record<string, any>, ValueType> = {
  [K in keyof T as T[K] extends ValueType ? K : never]: T[K];
};

type Result37 = FilterByValueType<Person, number>;
